<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%--@elvariable id="user" type="java.lang.String"--%>
<%--@elvariable id="contextPath" type="java.lang.String"--%>
<%--@elvariable id="currentUser" type="org.parademo.service.security.ParademoUser"--%>
<%--@elvariable id="proposals" type="java.util.List<org.parademo.web.model.ProposalListView>"--%>

<div class="proposalList">

    <h1>Proposals made by ${user}</h1>

    <c:if test="${empty proposals}">
        <div class="no_proposal">This user has not created any proposals</div>
    </c:if>

    <c:if test="${not empty proposals}">
        <table class="proposalListTable">
            <thead>
            <tr>
                <th>Title</th>
                <th>Internal</th>
                <th>Topic</th>
                <th>Status</th>
            </tr>
            </thead>

            <tbody>
            <%--<h1>TODO: replace this HORRIBLE list with the nice one made by Ionut</h1>--%>
            <c:forEach items="${proposals}" var="proposal">
                <!-- todo: properly handle double quotes -->
                <tr title="${proposal.description}">
                    <td><a href="${contextPath}/proposals/${proposal.id}">${proposal.title}</a></td>
                    <td>${proposal.internal}</td>
                    <td>${proposal.topic}</td>
                    <td>${proposal.status}</td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </c:if>
    <p><a href="javascript:" class="medium black button" onclick="document.location='${contextPath}/proposals?create'">Create Proposal</a></p>
</div>
